<template>
  <div class='hot_product'>
    <van-cell-group inset>
      <van-cell class="hot_title" :title="title" :border="false" center>
        <template #icon>
          <van-image class="hot_icon" :src="require('@/assets/img/product/hot.png')" fit="cover" />
        </template>
      </van-cell>
      <div class="list">
        <div class="item" v-for="(item, index) in list" :key="index" @click="click(item.product_id)">
          <van-image :src="`${resourceURL}${item.imageurl}`" fit="cover" />
          <div class="sale_price">￥{{item.mprice}}</div>
          <div class="product_name">{{item.product_name}}</div>
        </div>
      </div>
    </van-cell-group>
  </div>
</template>

<script>

export default {
  props: {
    title: { type: String, require: true },
    list: { type: Array, require: true },
  },
  data () {
    return {

    }
  },
  created () {
  },
  methods: {
    click (id) {
      this.$emit('detail', id)
    },
  },
}
</script>

<style scoped lang='less'>
.hot_product {
  .hot_title {
    color: #b60102;
    font-size: 16px;
    font-weight: bold;
    padding: 12px;
    background-image: linear-gradient(to bottom, #ffebc4, #ffffff);
  }
  .hot_icon {
    width: 25px;
    height: 21px;
    margin-right: 12px;
  }
  .list {
    display: flex;
    align-items: center;
    flex-basis: 106px;
    padding: 0 10px 10px;
    overflow: auto;
    .item {
      display: flex;
      flex-direction: column;
      width: 106px;
      padding-right: 6px;
      text-align: center;
      .van-image {
        width: 106px;
        height: 106px;
        border-radius: 10px;
        margin-top: 8px;
        overflow: hidden;
      }
      .sale_price {
        font-size: 16px;
        font-weight: bold;
        color: #fb2b2c;
        margin: 5px 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .product_name {
        width: 106px;
        font-size: 14px;
        color: #1d2120;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    }
    &::-webkit-scrollbar {
      display: none;
    }
  }
}
</style>
